import { User } from "./user.entity";
import { Entity, Column, OneToOne, JoinColumn, PrimaryColumn } from "typeorm";
@Entity('account_tb')
export class Account {
    @PrimaryColumn({ type: 'bigint', name: 'user_id' })
    user_id: number;
    @Column({ unique: true })
    username: string;
    @Column({ default: '123456', select: false })
    password: string;
    @OneToOne(()=> User, (user) => user.account, {
        cascade: true, // 允许级联操作
        onDelete: 'CASCADE', // 级联策略
    })
    @JoinColumn({ name: 'user_id' })
    user: User;
}